class UsersController < ApplicationController
  def welcome
    @title = "Login"
  end
  
  def create
    # if this is really a login, redirect
    login if params[:login]
  end
  
  def login
    pass = params[:user][:password]
    the_user = User.find(:first)
    if pass == the_user.password
      session[:user] = the_user
      redirect_to(reports_path)
    else
      redirect_to(welcome_users_path)
    end
  end
  
  def logout
    session[:user] = nil
    redirect_to(welcome_users_path)
  end
end
